package com.example.demo.dao;


import com.example.demo.entity.Orders;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface OrdersMapper {


    @Insert("insert into t_orders(id,order_id,customer_id,amount,status,create_date) values(#{id},#{orderId},#{customerId},#{amount},#{status},#{createDate})")
    public void insert(Orders orders);

    /**
     * 根据订单号查询订单详情
     */
    @Select("select * from t_orders where id = #{id}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "orderId", column = "order_id"),
            @Result(property = "orderType", column = "order_type"),
            @Result(property = "customerId", column = "customer_id"),
            @Result(property = "amount", column = "amount"),
            @Result(property = "status", column = "status"),
            @Result(property = "createDate", column = "create_date")
    })
    public Orders queryOrderById(Integer id);

}
